clear all; clc;
RC = 3960e-12;
T = RC/3;
a = [RC 1];
b = [1];
figure(1)
freqs(b, a);

Fs = 100; Fmax = 4e5; f = 0:Fs:Fmax;
H = freqs(b, a, 2*pi*f);



figure(3)
subplot(2,1,1);
plot(f/1e6, 20*log10(abs(H)));
subplot(2,1,2);
plot(f/1e6, rad2deg(unwrap(angle(H))));

figure(4);
sys = tf(b,a);
[y,t] = impulse(sys); 
plot(t, y);
xlabel('t, s'); ylabel('h(t)');
grid on

figure(5);
[z,p,k]=tf2zpk(b,a);
zplane(z,p);
figure(6);
az = [1+2*RC/T, 1-2*RC/T]; bz = [1, 1];
Hz = freqz(bz, az);
[Hs, w] = freqs(b, a);
plot(w/2/pi/1000, abs(Hs), ((1:length(Hz)) - 1)/ length(Hz) * 1/T/2/1000, abs(Hz))
xlabel('f, kHz'); ylabel('|H|')
legend('|H(s)|', '|H(z)|'); grid on;



 


